package org.example.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.example.entity.SysCont;
import org.example.mapper.DictionariesMapper;
import org.example.mapper.SysContMapper;
import org.example.service.SysContService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author wxm
 * @date 2025/3/6 15:26
 */
@Service
public class SysContServiceImpl extends ServiceImpl<SysContMapper, SysCont> implements SysContService {
    @Autowired
    private SysContMapper sysContMapper;
    @Autowired
    private DictionariesMapper dictionariesMapper;

    @Override
    public List<String> getContentByParent(String parentName) {
        return sysContMapper.selectContentByParentName(parentName);
    }

    @Override
    public void insertContentByParent(String parentName, String content) {
        Long id = dictionariesMapper.selectIdByParentName(parentName);
        sysContMapper.insertContentByParent(id, parentName, content);
    }
}
